package vcp.gui.secure.screens;

import java.awt.Dimension;

import javax.swing.GroupLayout;
import javax.swing.GroupLayout.Alignment;
import javax.swing.JScrollPane;


import vcp.gui.components.VCPPanel;
import vcp.gui.components.VCPTable;

public class ScreenSaveParking extends VCPPanel {
	private VCPTable table;
	private JScrollPane tabPane;

	/**
	 * Create the panel.
	 */
	public ScreenSaveParking() {

		String[] columnNames = { "Order ID", "Customer ID", "Customer Name" };

		Object[][] data = {
				{ new Integer(12345678), new Integer(12345678), "Test Customer" },
				{ new Integer(12345678), new Integer(12345678), "Other test" } };
		tabPane = new JScrollPane(getTable(columnNames,data));

		GroupLayout groupLayout = new GroupLayout(this);
		groupLayout.setHorizontalGroup(groupLayout.createParallelGroup(
				Alignment.LEADING).addGroup(
				groupLayout
						.createSequentialGroup()
						.addComponent(tabPane, GroupLayout.PREFERRED_SIZE,
								459, GroupLayout.PREFERRED_SIZE)
						.addContainerGap(GroupLayout.DEFAULT_SIZE,
								Short.MAX_VALUE)));
		groupLayout.setVerticalGroup(groupLayout.createParallelGroup(
				Alignment.LEADING).addGroup(
				groupLayout
						.createSequentialGroup()
						.addComponent(tabPane, GroupLayout.PREFERRED_SIZE,
								164, GroupLayout.PREFERRED_SIZE)
						.addContainerGap(GroupLayout.DEFAULT_SIZE,
								Short.MAX_VALUE)));
		setLayout(groupLayout);
	}

	private VCPTable getTable(String[] columnNames,Object[][] data) {
		if (table == null) {
			table = new VCPTable(data, columnNames) {
				private static final long serialVersionUID = 1L;

				public boolean isCellEditable(int row, int column) {
					return false;
				};
			};

			table.setPreferredScrollableViewportSize(new Dimension(500, 70));
			table.setFillsViewportHeight(true);

			return table;
		}
		return null;
	}
	
	
	
	
}
